package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name = "EMPLOYEE")
public class Employee implements Serializable {

	private static final long serialVersionUID = -1400171974832798944L;

	private Integer id;
	private Enterprise enterprise;
	private Person person;
	private String active;
	private List<UserAccount> userAccount;

	/**
	 * Gets id (primary key).
	 */
	@Id
	@Column(name = "EMPLOYEE")
	@SequenceGenerator(name = "employee_id", sequenceName = "employee_id", allocationSize = 1)
	@GeneratedValue(generator = "employee_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@OneToOne
	@JoinColumn(name = "ENTERPRISE_FK", nullable = false)
	public Enterprise getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(Enterprise enterprise) {
		this.enterprise = enterprise;
	}

	@OneToOne
	@JoinColumn(name = "PERSON_FK", nullable = false)
	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public String getActive() {
		return active;
	}

	public void setActive(String active) {
		this.active = active;
	}

	@OneToMany(mappedBy = "subject", cascade = CascadeType.REFRESH)
	public List<UserAccount> getUserAccount() {
		return userAccount;
	}

	public void setUserAccount(List<UserAccount> userAccount) {
		this.userAccount = userAccount;
	}
}
